RDMA/hns: Add constraint on the setting of local ACK timeout
authorLijun Ou <oulijun@huawei.com>
Wed, 12 Dec 2018 09:49:08 +0000 (17:49 +0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 18 Jul 2019 22:23:17 +0000 (23:23 +0100)
According to IB protocol, local ACK timeout shall be a 5 bit
value. Currently, hip08 could not support the possible max value 31. Fail
the request in this case.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Gbp-Pq: Topic bugfix/arm64/huawei-taishan
Gbp-Pq: Name 0029-RDMA-hns-Add-constraint-on-the-setting-of-local-ACK-.patch

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index c7843d9817deabfab1474fddd80a76f86c230848..627f77a6e0a97db3b1f38b36ae2aaf47fe67a612 100644 (file)
@@ -3398,10 +3398,16 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp,
                       V2_QPC_BYTE_212_LSN_S, 0);
 
        if (attr_mask & IB_QP_TIMEOUT) {
-               roce_set_field(context->byte_28_at_fl, V2_QPC_BYTE_28_AT_M,
-                              V2_QPC_BYTE_28_AT_S, attr->timeout);
-               roce_set_field(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_AT_M,
-                             V2_QPC_BYTE_28_AT_S, 0);
+               if (attr->timeout < 31) {
+                       roce_set_field(context->byte_28_at_fl,
+                                      V2_QPC_BYTE_28_AT_M, V2_QPC_BYTE_28_AT_S,
+                                      attr->timeout);
+                       roce_set_field(qpc_mask->byte_28_at_fl,
+                                      V2_QPC_BYTE_28_AT_M, V2_QPC_BYTE_28_AT_S,
+                                      0);
+               } else {
+                       dev_warn(dev, "Local ACK timeout shall be 0 to 30.\n");
+               }
        }
 
        roce_set_field(context->byte_172_sq_psn, V2_QPC_BYTE_172_SQ_CUR_PSN_M,